package com.ruoyi.business.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.TMessageReadMapper;
import com.ruoyi.business.domain.TMessageRead;
import com.ruoyi.business.service.ITMessageReadService;

/**
 * 消息已读记录Service业务层处理
 * 
 * @author laoguo
 * @date 2025-08-13
 */
@Service
public class TMessageReadServiceImpl implements ITMessageReadService 
{
    @Autowired
    private TMessageReadMapper tMessageReadMapper;

    /**
     * 查询消息已读记录
     * 
     * @param recordId 消息已读记录主键
     * @return 消息已读记录
     */
    @Override
    public TMessageRead selectTMessageReadByRecordId(Long recordId)
    {
        return tMessageReadMapper.selectTMessageReadByRecordId(recordId);
    }

    /**
     * 查询消息已读记录列表
     * 
     * @param tMessageRead 消息已读记录
     * @return 消息已读记录
     */
    @Override
    public List<TMessageRead> selectTMessageReadList(TMessageRead tMessageRead)
    {
        return tMessageReadMapper.selectTMessageReadList(tMessageRead);
    }

    /**
     * 新增消息已读记录
     * 
     * @param tMessageRead 消息已读记录
     * @return 结果
     */
    @Override
    public int insertTMessageRead(TMessageRead tMessageRead)
    {
        return tMessageReadMapper.insertTMessageRead(tMessageRead);
    }

    /**
     * 修改消息已读记录
     * 
     * @param tMessageRead 消息已读记录
     * @return 结果
     */
    @Override
    public int updateTMessageRead(TMessageRead tMessageRead)
    {
        return tMessageReadMapper.updateTMessageRead(tMessageRead);
    }

    /**
     * 批量删除消息已读记录
     * 
     * @param recordIds 需要删除的消息已读记录主键
     * @return 结果
     */
    @Override
    public int deleteTMessageReadByRecordIds(Long[] recordIds)
    {
        return tMessageReadMapper.deleteTMessageReadByRecordIds(recordIds);
    }

    /**
     * 删除消息已读记录信息
     * 
     * @param recordId 消息已读记录主键
     * @return 结果
     */
    @Override
    public int deleteTMessageReadByRecordId(Long recordId)
    {
        return tMessageReadMapper.deleteTMessageReadByRecordId(recordId);
    }

    /**
     * 根据用户ID查询其所有已读消息记录
     *
     * @param userId 用户ID
     * @return 已读消息记录列表
     */
    @Override
    public List<TMessageRead> selectTMessageReadListByUserId(Long userId) {
        return tMessageReadMapper.selectTMessageReadListByUserId(userId);
    }
}
